package kr.hkit.framework.inputPanel;

import javax.swing.JPanel;
import java.awt.GridLayout;
import javax.swing.JLabel;
import javax.swing.JComboBox;
import javax.swing.SwingConstants;

public class InputCmbPanel extends JPanel {
	private JLabel lblTitle;
	private JComboBox<String> cmbValue;

	public InputCmbPanel() {
		initialize();
	}
	
	public InputCmbPanel(String title){
		initialize();
		lblTitle.setText(title);
	}
	
	public void setLblTitle(String title){
		lblTitle.setText(title);
	}
	
	public void setComboItems(String...item){
		for(String str : item){
			cmbValue.addItem(str);
		}
	}
	
	public String getSelectedItem(){
		return (String) cmbValue.getSelectedItem();
	}
	
	public void setDefaultSelectIndex(int i){
		cmbValue.setSelectedIndex(i);
	}

	private void initialize() {
		setLayout(new GridLayout(0, 2, 5, 5));

		lblTitle = new JLabel("New label");
		lblTitle.setHorizontalAlignment(SwingConstants.CENTER);
		add(lblTitle);

		cmbValue = new JComboBox();
		add(cmbValue);
	}
	
	

}
